﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ThanhTu.GNCMedia.KQXS.DataAccess.DAL;
using ThanhTu.GNCMedia.KQXS.DataAccess.DO;

namespace WebUI.Admin
{
    public partial class AddNewKindOfAward : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        private bool checkData(string idloaigiai, string tenloaigiai)
        {
            bool ck = false;
            if (idloaigiai.Trim().Equals("") || tenloaigiai.Trim().Equals(""))
            {
                ck = false;

            }
            else
            {
                ck = true;
            }
            return ck;


        }
        protected void btn_addNewData_Click1(object sender, EventArgs e)
        {
            KindOfAwardsDAL kindOfAwardDAL = new KindOfAwardsDAL();
            KindOfAwardsDO kindOfAwardDO = new KindOfAwardsDO();
            if (checkData(txt_idLoaiGiai.Text, txt_tenLoaiGiai.Text))
            {
                kindOfAwardDO.AwardsID = Convert.ToInt32(txt_idLoaiGiai.Text);
                kindOfAwardDO.AwardsName = txt_tenLoaiGiai.Text;
                int checkInsert = kindOfAwardDAL.add(kindOfAwardDO);
                if (checkInsert > 0)
                {
                    Lbl_Requiment.ForeColor = System.Drawing.Color.Red;
                    Lbl_Requiment.Text = "Insert New kind Of Award Sucessful";
                }
            }
            else
            {
                Lbl_Requiment.ForeColor = System.Drawing.Color.Red;
                Lbl_Requiment.Text = "Some Data is Empty,please input full Data";
            }


        }

        protected void lbtnLogout_Click(object sender, EventArgs e)
        {
            Session.Remove("UserName");
            Response.Redirect("Login.aspx");
        }
    }
}